Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added configuration to enable/disable Clear Shopping Cart action in storefront #28594

Conversation

joctabio
Copy link
Contributor

@joctabio joctabio commented Jun 5, 2020

Description (*)

Added admin configuration to enable/disable Clear Shopping Cart action with added confirmation modal when clicked.

The native Clear Shopping Cart action is hidden in Luma via CSS, this PR will remove the CSS hidden styling from the theme and create a configuration in the admin panel to control the display.

Added Configuration:

  • Admin > Stores > Configuration > Sales > Checkout
    • Enable Clear Shopping Cart - (Default value: No)

enable clear shopping cart config

clear shopping cart action

Added Behaviour:

  • When Clear Shopping Cart is clicked, triggers a confirmation widget.

Clear Shopping cart 1 – 1

  • Clicking OK will clear your cart and redirect to an empty cart page.

empty cart page

Fixes Issue(s)

https://github.com/magento/partners-magento2b2b/issues/108

Related Pull Requests

#27917

Manual testing scenarios (*)

  1. Go to Admin > Stores > Configuration > Sales > Checkout
  2. Set Enable Clear Shopping Cart to Yes
  3. Click Save Config
  4. Add a product to cart
  5. Visit the Shopping Cart page
  6. Clear Shopping Cart action should be visible beside the Update Shopping Cart action
  7. Click Clear Shopping Cart and a confirmation modal should popup
  8. Click OK, you will be redirected to the empty cart page and your cart should now be empty

Questions or comments

Do these changes require functional tests? If so, I would need assistance with writing the tests.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Approval Ticket

https://jira.corp.magento.com/browse/MC-35122


Test Plan

Manual checks for ticket

  • Verify new configuration option exists in store configuration on Sales > Checkout
    • Check placement of new option (make sure it matches UX mockup)
    • Should be website confg
    • Should be disabled by default w/ "Use system value" checked & default value of No
  • Verify can enable/disable and uncheck/check checkbox for new config using UI (saves successfully)
  • Verify can enable/disable new config using magento cli
  • Verify new config is not available to change at store or storeview scope (change scope in upper left drop-down)
  • Saving new config option should trigger configuration cache & page cache to invalidate (& the admin warning message to appear)
  • Verify that enabling new config will cause Clear Shopping Cart button to appear in cart on storefront
    • Verify that it does NOT appear when cart is empty (go to /checkout/cart/index)
  • Verify that clicking the button & then OK on modal will empty shopping cart
    • Check for 1 product
    • Check for multiple products w/ multiple quantities
    • Check that mini cart empties as well
    • Edge Case: open cart w/ products, open cart in another browser tab, in tab 2, click clear cart button & accept modal to empty cart, go to tab1 & click clear cart button & accept modal. Verify no errors and user is shown the empty cart page after page reload
  • Verify that clicking the button & then clicking cancel on the modal will not change the cart nor reload the page
    • Same for clicking outside modal or hitting Esc on keyboard
  • Verify that confirmation modal matches UX mockups
  • Verify that disabling new config will cause Clear Shopping Cart button to not appear in DOM in cart on storefront
  • Verify that deleting the configuration row from core_config_data database table will cause Clear Shopping Cart button to not appear in DOM in cart on storefront (simulates upgrade)
  • Verify that config can be changed at website level and behaves correctly for websites. Check following scenarios:
    • Disabled for default config, enabled for website: Should be enabled on storefront for website
    • Enabled for default config, disabled for website: Should be disabled on storefront for website
    • Disabled for default config, doesn't exist in db for website: Should be disabled on storefront for website
    • Enabled for default config, doesn't exist in db for website: Should be enabled on storefront for website
    • Doesn't exist in db for for default config, enabled for website: Should be enabled on storefront for website
    • Doesn't exist in db for for default config, doesn't exist in db for website: Should be disabled on storefront for website
  • Check translations (of store configuration label, values, checkbox, storefront button text, modal buttons, modal message)
  • Check that button on storefront can be focused & clicked using keyboard (accessibility test). Verify modal can be interacted with (cancel & ok) using only keyboard
  • Check new button on Luma theme & Blank theme
  • Check new button works on Chrome, Safari, Firefox, Edge, iPhone simulator, android simulator
  • Verify new config can be changed & saved when Magento is installed w/ database prefix

Automated MFTF Tests

  • New Test 1
    ** (see PR MFTF comments)

Manual Hip Tests

No new tests

Neos2007 and others added 7 commits June 1, 2020 18:28
…ing cart view page. Modified styles in the luma theme which hide clear cart buton. Created functional test for testing showing/hiding clear cart button on the cart page.
…onfiguration for display of clear shopping cart button
…tton display configuration with modal confirm widget
….com:jacotabio/magento2 into 108_clear-shopping-cart-button-configuration
@joctabio joctabio added Component: Checkout Area: Frontend partners-contribution Pull Request is created by Magento Partner labels Jun 5, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jun 5, 2020

Hi @jacotabio. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@joctabio joctabio changed the title 108 clear shopping cart button configuration Added configuration to enable/disable Clear Shopping Cart action Jun 5, 2020
@joctabio joctabio changed the title Added configuration to enable/disable Clear Shopping Cart action Added configuration to enable/disable Clear Shopping Cart action in storefront Jun 5, 2020
@Serializator
Copy link

Hi @jacotabio,

composer.lock shouldn't be deleted. It's the file that determines the exact version of a dependency to be installed and without it different installations might use different versions of a dependency based on the version range specified in composer.json

@joctabio
Copy link
Contributor Author

joctabio commented Jun 9, 2020

Hi @jacotabio,

composer.lock shouldn't be deleted. It's the file that determines the exact version of a dependency to be installed and without it different installations might use different versions of a dependency based on the version range specified in composer.json

Fixed it

@smuletf
Copy link

smuletf commented Jun 9, 2020

Thanks for the review @dobooth. I just updated the designs on the story description

John Carlo Octabio added 4 commits June 9, 2020 18:50
…ck in shopping-cart.js and fix Grid.php PHPdoc long description
… _confirmClearCart for a simple and concise function naming
…r error must have one blank line between short and long description
@danmooney2
Copy link
Member

@jacotabio We have good news about this PR! We have approval on the System Changes (Minor) in Semantic Version Checker. We still need to refactor this code to remove the Class Changes as we discussed in our DMs on Slack (make constant private, move constant and method to new View Model class). After that, we should be good to go on moving this forward with Ready for Testing!

@danmooney2
Copy link
Member

Internal Approval Ticket: https://jira.corp.magento.com/browse/MC-35122

John Carlo Octabio added 2 commits July 24, 2020 17:10
…shopping cart modal incorrect wording string
….com:joctabio/magento2 into 108_clear-shopping-cart-button-configuration
@joctabio
Copy link
Contributor Author

@magento run all tests

@mbrinton01
Copy link

Approved based on demo on July 24

magento-engcom-team pushed a commit that referenced this pull request Jul 29, 2020
@magento-engcom-team magento-engcom-team merged commit 4b54f3d into magento:2.4-develop Jul 29, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jul 29, 2020

Hi @joctabio, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Design/Frontend Area: Frontend Component: Checkout Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development PAP B2B Team 1 partners-contribution Pull Request is created by Magento Partner Priority: P3 May be fixed according to the position in the backlog. Progress: accept project: B2B Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.